Skip to content

Add configurable scroll-to-top behavior to dcc.Link - #3976

Merged
T4rk1n merged 4 commits into
plotly:devfrom
CNFeffery:dev
Sep 29, 2026
Merged

T4rk1n merged 4 commits into
plotly:devfrom
CNFeffery:dev

Conversation

@CNFeffery

Copy link
Copy Markdown
Contributor

This PR makes the automatic scroll-to-top behavior of dcc.Link configurable.

  • Add a new boolean scrollToTop prop that defaults to true, preserving the existing behavior.
  • Only call window.scrollTo(0, 0) when scrollToTop is enabled.

Closes #3974

@AnnMarieW

Copy link
Copy Markdown
Collaborator

Nice PR!
Just chiming in here...

What do you think about naming the prop scrollTo (or scroll_to) and allowing the arguments supported by Element.scrollTo ?

It could default to the current behavior, scrollTo(0, 0), and also allow the options dict with top, left, and behavior.

@CNFeffery

Copy link
Copy Markdown
Contributor Author

Nice PR! Just chiming in here...

What do you think about naming the prop scrollTo (or scroll_to) and allowing the arguments supported by Element.scrollTo ?

It could default to the current behavior, scrollTo(0, 0), and also allow the options dict with top, left, and behavior.

Since for the dcc.Link component, its built‑in behavior policy only has two states: whether to automatically scroll back to the top. Introducing more complex scroll‑position parameter controls does not seem necessary at this stage.

@camdecoster camdecoster assigned KoolADE85 and unassigned T4rk1n Sep 9, 2026

@T4rk1n T4rk1n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@camdecoster camdecoster assigned T4rk1n and unassigned KoolADE85 Sep 21, 2026
@sonarqubecloud

Copy link
Copy Markdown

@T4rk1n
T4rk1n merged commit 9f61b15 into plotly:dev Sep 29, 2026
48 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Condition dcc.Link's window.scrollTo(0,0) on a component prop

4 participants